package com.yupi.springbootinit.statemachine.dto;

import com.yupi.springbootinit.common.PageRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 状态转换记录查询请求DTO
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "状态转换记录查询请求")
public class StateTransitionRecordQueryRequest extends PageRequest {
    
    @Schema(description = "实体ID")
    private Long entityId;
    
    @Schema(description = "实体类型", example = "ORDER")
    private String entityType;
    
    @Schema(description = "实体类型列表")
    private List<String> entityTypes;
    
    @Schema(description = "源状态编码")
    private String fromStateCode;
    
    @Schema(description = "目标状态编码")
    private String toStateCode;
    
    @Schema(description = "状态转换类型", example = "CREATED->ROUTING_PUBLISHED")
    private String transitionType;
    
    @Schema(description = "操作用户ID")
    private Long operatorId;
    
    @Schema(description = "操作用户名")
    private String operatorName;
    
    @Schema(description = "转换是否成功")
    private Boolean success;
    
    @Schema(description = "错误码")
    private String errorCode;
    
    @Schema(description = "开始时间", example = "2024-01-01 00:00:00")
    private String startTime;
    
    @Schema(description = "结束时间", example = "2024-12-31 23:59:59")
    private String endTime;
    
    @Schema(description = "最小耗时(毫秒)")
    private Long minDuration;
    
    @Schema(description = "最大耗时(毫秒)")
    private Long maxDuration;
    
    @Schema(description = "关键词搜索(备注、错误信息)")
    private String keyword;
    
    @Schema(description = "是否只查询失败记录")
    private Boolean onlyFailed;
    
    @Schema(description = "是否只查询慢转换记录")
    private Boolean onlySlow;
    
    @Schema(description = "慢转换阈值(毫秒)", example = "5000")
    private Long slowThreshold;
    
    @Schema(description = "排序字段", example = "createTime")
    private String sortField;
    
    @Schema(description = "排序方向", example = "desc", allowableValues = {"asc", "desc"})
    private String sortOrder;
    
    @Schema(description = "源状态")
    private String fromState;
    
    @Schema(description = "目标状态")
    private String toState;
    
    @Schema(description = "触发事件")
    private String event;
    
    @Schema(description = "错误信息")
    private String errorMessage;
}
